//
//  ClassifyVC.m
//  echo
//
//  Created by dllo on 16/2/25.
//  Copyright © 2016年 Danny. All rights reserved.
//

#define WIDTH [UIScreen mainScreen].bounds.size.width / 414
#define HEIGHT [UIScreen mainScreen].bounds.size.height / 736

#import "ClassifyVC.h"
#import "CellForMyExploreTableViewSectionThreeAndFour.h"
#import "NetworkingHandler.h"
#import "ModelOfCellForClassifyVCSectionZero.h"
#import "CellForClassifyVCSectionZero.h"
#import "ModelOfCellForClassifyVCSectionOneToNine.h"
#import <DKNightVersion.h>
#import "SQLHandler.h"
#import "VideoPlayerVC.h"
#import "ModelOfCellForMyExploreTableViewSectionOne.h"
#import "InformationVC.h"

@interface ClassifyVC ()<UITableViewDataSource, UITableViewDelegate, CellForMyExploreTableViewSectionThreeAndFour, UITabBarControllerDelegate>
@property (nonatomic, retain)UITableView *tableView;
@property (nonatomic, retain)NSMutableArray *arrForCellOfSectionZero;
@property (nonatomic, retain)NSMutableArray *arrForEverySection;
@property (nonatomic, retain)NSMutableArray *arrForCellOfSectionOneToNine;
@end

@implementation ClassifyVC

- (void)dealloc{
    [_arrForCellOfSectionZero release];
    [_arrForEverySection release];
    [_arrForCellOfSectionOneToNine release];
    self.tableView.delegate = nil;
    [_tableView release];
    [super dealloc];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    self.navigationItem.hidesBackButton = YES;
    [self handleDataForCellOfSectionZero];
    self.tabBarController.delegate = self;
}

- (void)handleDataForCellOfSectionZero{
    [NetworkingHandler networkingGetWithUrl:@"http://echosystem.kibey.com/echofamous/user/list-by-type?famous_type=0&version=1&page=0" dicForValue:@{@"x-v":@"20160209", @"x-c":@"3"} completeHandle:^(id result) {
        NSDictionary *dic = [result objectForKey:@"result"];
        NSArray *arr = [dic objectForKey:@"famous_type_list"];
        self.arrForCellOfSectionZero = [NSMutableArray array];
        for (NSDictionary *tempDic in arr) {
            ModelOfCellForClassifyVCSectionZero *model = [[ModelOfCellForClassifyVCSectionZero alloc]init];
            [model setValuesForKeysWithDictionary:tempDic];
            [self.arrForCellOfSectionZero addObject:model];
            [model release];
        }
        [self handleDataForCellOfSectionOntToNine];
        
    }];
}

- (void)handleDataForCellOfSectionOntToNine{
    
    [NetworkingHandler networkingGetWithUrl:@"http://echosystem.kibey.com/echofamous/user/list-by-type?famous_type=0&version=1&page=0" dicForValue:@{@"x-v":@"20160209", @"x-c":@"3"} completeHandle:^(id result) {
        NSDictionary *dic = [result objectForKey:@"result"];
        NSMutableArray *arr = [dic objectForKey:@"famous_users"];
        self.arrForEverySection = [NSMutableArray array];
        for (NSDictionary *tempDic in arr) {
            ModelOfCellForClassifyVCSectionOneToNine *model = [[ModelOfCellForClassifyVCSectionOneToNine alloc]init];
            [model setValuesForKeysWithDictionary:tempDic];
            [self.arrForEverySection addObject:model];
            [model release];
        }
        [self createTableView];
    }];
}

- (void)createTableView{
#pragma mark - tableView位置有问题
    self.tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 29, self.view.frame.size.width, self.view.frame.size.height - 58) style:UITableViewStyleGrouped];
    self.tableView.dk_backgroundColorPicker = DKColorWithColors([UIColor whiteColor], [UIColor colorWithRed:17 / 256.f green:27 / 256.f blue:47 / 256.f alpha:1]);
    [self.view addSubview:self.tableView];
    [self.tableView release];
    self.tableView.dataSource = self;
    self.tableView.delegate = self;
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.tableView.showsVerticalScrollIndicator = NO;
    self.automaticallyAdjustsScrollViewInsets = NO;
    [self.tableView registerClass:[CellForClassifyVCSectionZero class] forCellReuseIdentifier:@"poolForCellOfClassifyVCSectionZero"];
    [self.tableView registerClass:[CellForMyExploreTableViewSectionThreeAndFour class] forCellReuseIdentifier:@"poolForCellOfClassifyVCSectionOneToNine"];
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 10;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    if (section == 0) {
        return 1;
        
    }else if (section == 9){
        return 2;
        
    }else{
        return 3;
        
    }
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.section == 0) {
        CellForClassifyVCSectionZero *cell = [tableView dequeueReusableCellWithIdentifier:@"poolForCellOfClassifyVCSectionZero"];
        [cell passArr:self.arrForCellOfSectionZero];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        return cell;
    }else{
        CellForMyExploreTableViewSectionThreeAndFour *cell = [tableView dequeueReusableCellWithIdentifier:@"poolForCellOfClassifyVCSectionOneToNine"];
        [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
        cell.delegate2 = self;
        if (indexPath.section == 1) {
          ModelOfCellForClassifyVCSectionOneToNine *model = [self.arrForEverySection objectAtIndex:0];
            NSMutableArray *arrOfEvery = model.users;
            if (indexPath.row == 0) {
                NSMutableDictionary *dicOfEvery = [arrOfEvery objectAtIndex:0];
                [cell passDataOfCellForClassifyVCSectionOneToNine:dicOfEvery];
                return cell;
            }else if (indexPath.row == 1){
                NSMutableDictionary *dicOfEvery = [arrOfEvery objectAtIndex:1];
                [cell passDataOfCellForClassifyVCSectionOneToNine:dicOfEvery];
                return cell;
            }else{
                NSMutableDictionary *dicOfEvery = [arrOfEvery objectAtIndex:2];
                [cell passDataOfCellForClassifyVCSectionOneToNine:dicOfEvery];
                return cell;
            }
        }else if (indexPath.section == 2){
            ModelOfCellForClassifyVCSectionOneToNine *model = [self.arrForEverySection objectAtIndex:1];
            NSMutableArray *arrOfEvery = model.users;
            if (indexPath.row == 0) {
                NSMutableDictionary *dicOfEvery = [arrOfEvery objectAtIndex:0];
                [cell passDataOfCellForClassifyVCSectionOneToNine:dicOfEvery];
                return cell;
            }else if (indexPath.row == 1){
                NSMutableDictionary *dicOfEvery = [arrOfEvery objectAtIndex:1];
                [cell passDataOfCellForClassifyVCSectionOneToNine:dicOfEvery];
                return cell;
            }else{
                NSMutableDictionary *dicOfEvery = [arrOfEvery objectAtIndex:2];
                [cell passDataOfCellForClassifyVCSectionOneToNine:dicOfEvery];
                return cell;
            }
            
        }else if (indexPath.section == 3){
            ModelOfCellForClassifyVCSectionOneToNine *model = [self.arrForEverySection objectAtIndex:2];
            NSMutableArray *arrOfEvery = model.users;
            if (indexPath.row == 0) {
                NSMutableDictionary *dicOfEvery = [arrOfEvery objectAtIndex:0];
                [cell passDataOfCellForClassifyVCSectionOneToNine:dicOfEvery];
                return cell;
            }else if (indexPath.row == 1){
                NSMutableDictionary *dicOfEvery = [arrOfEvery objectAtIndex:1];
                [cell passDataOfCellForClassifyVCSectionOneToNine:dicOfEvery];
                return cell;
            }else{
                NSMutableDictionary *dicOfEvery = [arrOfEvery objectAtIndex:2];
                [cell passDataOfCellForClassifyVCSectionOneToNine:dicOfEvery];
                return cell;
            }
        }else if (indexPath.section == 4){
            ModelOfCellForClassifyVCSectionOneToNine *model = [self.arrForEverySection objectAtIndex:3];
            NSMutableArray *arrOfEvery = model.users;
            if (indexPath.row == 0) {
                NSMutableDictionary *dicOfEvery = [arrOfEvery objectAtIndex:0];
                [cell passDataOfCellForClassifyVCSectionOneToNine:dicOfEvery];
                return cell;
            }else if (indexPath.row == 1){
                NSMutableDictionary *dicOfEvery = [arrOfEvery objectAtIndex:1];
                [cell passDataOfCellForClassifyVCSectionOneToNine:dicOfEvery];
                return cell;
            }else{
                NSMutableDictionary *dicOfEvery = [arrOfEvery objectAtIndex:2];
                [cell passDataOfCellForClassifyVCSectionOneToNine:dicOfEvery];
                return cell;
            }
        }else if (indexPath.section == 5){
            ModelOfCellForClassifyVCSectionOneToNine *model = [self.arrForEverySection objectAtIndex:4];
            NSMutableArray *arrOfEvery = model.users;
            if (indexPath.row == 0) {
                NSMutableDictionary *dicOfEvery = [arrOfEvery objectAtIndex:0];
                [cell passDataOfCellForClassifyVCSectionOneToNine:dicOfEvery];
                return cell;
            }else if (indexPath.row == 1){
                NSMutableDictionary *dicOfEvery = [arrOfEvery objectAtIndex:1];
                [cell passDataOfCellForClassifyVCSectionOneToNine:dicOfEvery];
                return cell;
            }else{
                NSMutableDictionary *dicOfEvery = [arrOfEvery objectAtIndex:2];
                [cell passDataOfCellForClassifyVCSectionOneToNine:dicOfEvery];
                return cell;
            }
        }else if (indexPath.section == 6){
            ModelOfCellForClassifyVCSectionOneToNine *model = [self.arrForEverySection objectAtIndex:5];
            NSMutableArray *arrOfEvery = model.users;
            if (indexPath.row == 0) {
                NSMutableDictionary *dicOfEvery = [arrOfEvery objectAtIndex:0];
                [cell passDataOfCellForClassifyVCSectionOneToNine:dicOfEvery];
                return cell;
            }else if (indexPath.row == 1){
                NSMutableDictionary *dicOfEvery = [arrOfEvery objectAtIndex:1];
                [cell passDataOfCellForClassifyVCSectionOneToNine:dicOfEvery];
                return cell;
            }else{
                NSMutableDictionary *dicOfEvery = [arrOfEvery objectAtIndex:2];
                [cell passDataOfCellForClassifyVCSectionOneToNine:dicOfEvery];
                return cell;
            }
        }else if (indexPath.section == 7){
            ModelOfCellForClassifyVCSectionOneToNine *model = [self.arrForEverySection objectAtIndex:6];
            NSMutableArray *arrOfEvery = model.users;
            if (indexPath.row == 0) {
                NSMutableDictionary *dicOfEvery = [arrOfEvery objectAtIndex:0];
                [cell passDataOfCellForClassifyVCSectionOneToNine:dicOfEvery];
                return cell;
            }else if (indexPath.row == 1){
                NSMutableDictionary *dicOfEvery = [arrOfEvery objectAtIndex:1];
                [cell passDataOfCellForClassifyVCSectionOneToNine:dicOfEvery];
                return cell;
            }else{
                NSMutableDictionary *dicOfEvery = [arrOfEvery objectAtIndex:2];
                [cell passDataOfCellForClassifyVCSectionOneToNine:dicOfEvery];
                return cell;
            }
        }else if (indexPath.section == 8){
            ModelOfCellForClassifyVCSectionOneToNine *model = [self.arrForEverySection objectAtIndex:7];
            NSMutableArray *arrOfEvery = model.users;
            if (indexPath.row == 0) {
                NSMutableDictionary *dicOfEvery = [arrOfEvery objectAtIndex:0];
                [cell passDataOfCellForClassifyVCSectionOneToNine:dicOfEvery];
                return cell;
            }else if (indexPath.row == 1){
                NSMutableDictionary *dicOfEvery = [arrOfEvery objectAtIndex:1];
                [cell passDataOfCellForClassifyVCSectionOneToNine:dicOfEvery];
                return cell;
            }else{
                NSMutableDictionary *dicOfEvery = [arrOfEvery objectAtIndex:2];
                [cell passDataOfCellForClassifyVCSectionOneToNine:dicOfEvery];
                return cell;
            }
        }else{
            ModelOfCellForClassifyVCSectionOneToNine *model = [self.arrForEverySection objectAtIndex:8];
            NSMutableArray *arrOfEvery = model.users;
            if (indexPath.row == 0) {
                NSMutableDictionary *dicOfEvery = [arrOfEvery objectAtIndex:0];
                [cell passDataOfCellForClassifyVCSectionOneToNine:dicOfEvery];
                return cell;
            }else{
                NSMutableDictionary *dicOfEvery = [arrOfEvery objectAtIndex:1];
                [cell passDataOfCellForClassifyVCSectionOneToNine:dicOfEvery];
                return cell;
            }
        }
    }
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    if (section == 0) {
        UIView *viewOfBackForSectionZero = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 40 * HEIGHT)];
        viewOfBackForSectionZero.dk_backgroundColorPicker = DKColorWithColors([UIColor colorWithRed:218 / 255.f green:219 / 255.f blue:216 / 255.f alpha:1], [UIColor colorWithRed:17 / 256.f green:27 / 256.f blue:47 / 256.f alpha:1]);
        UILabel *labelForSectionZero = [[UILabel alloc]initWithFrame:CGRectMake(10 * WIDTH, 5 * HEIGHT, self.view.frame.size.width - 20 * WIDTH, 40 * HEIGHT)];
        [viewOfBackForSectionZero addSubview:labelForSectionZero];
        [labelForSectionZero release];
        labelForSectionZero.text = @"      名人分类";
        labelForSectionZero.font = [UIFont fontWithName:@"Arial" size:17.0];
        labelForSectionZero.dk_textColorPicker = DKColorWithColors([UIColor blackColor], [UIColor whiteColor]);
        return viewOfBackForSectionZero;
    }else if (section == 1){
        UIView *viewOfBackForSectionOne = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 40 * HEIGHT)];
        viewOfBackForSectionOne.dk_backgroundColorPicker = DKColorWithColors([UIColor colorWithRed:218 / 255.f green:219 / 255.f blue:216 / 255.f alpha:1], [UIColor colorWithRed:17 / 256.f green:27 / 256.f blue:47 / 256.f alpha:1]);
        UILabel *labelForSectionOne = [[UILabel alloc]initWithFrame:CGRectMake(10 * WIDTH, 5 * HEIGHT, self.view.frame.size.width - 20 * WIDTH, 40 * HEIGHT)];
        [viewOfBackForSectionOne addSubview:labelForSectionOne];
        [labelForSectionOne release];
        labelForSectionOne.text = @"      歌手";
        labelForSectionOne.font = [UIFont fontWithName:@"Arial" size:17.0];
        labelForSectionOne.dk_textColorPicker = DKColorWithColors([UIColor blackColor], [UIColor whiteColor]);
        return viewOfBackForSectionOne;
    }else if (section == 2){
        UIView *viewOfBackForSectionTwo = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 40 * HEIGHT)];
        viewOfBackForSectionTwo.dk_backgroundColorPicker = DKColorWithColors([UIColor colorWithRed:218 / 255.f green:219 / 255.f blue:216 / 255.f alpha:1], [UIColor colorWithRed:17 / 256.f green:27 / 256.f blue:47 / 256.f alpha:1]);
        UILabel *labelForSectionTwo = [[UILabel alloc]initWithFrame:CGRectMake(10 * WIDTH, 5 * HEIGHT, self.view.frame.size.width - 20 * WIDTH, 40 * HEIGHT)];
        [viewOfBackForSectionTwo addSubview:labelForSectionTwo];
        [labelForSectionTwo release];
        labelForSectionTwo.text = @"      音乐制作人";
        labelForSectionTwo.font = [UIFont fontWithName:@"Arial" size:17.0];
        labelForSectionTwo.dk_textColorPicker = DKColorWithColors([UIColor blackColor], [UIColor whiteColor]);
        return viewOfBackForSectionTwo;
    }else if (section == 3){
        UIView *viewOfBackForSectionThree = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 40 * HEIGHT)];
        viewOfBackForSectionThree.dk_backgroundColorPicker = DKColorWithColors([UIColor colorWithRed:218 / 255.f green:219 / 255.f blue:216 / 255.f alpha:1], [UIColor colorWithRed:17 / 256.f green:27 / 256.f blue:47 / 256.f alpha:1]);
        UILabel *labelForSectionThree = [[UILabel alloc]initWithFrame:CGRectMake(10 * WIDTH, 5 * HEIGHT, self.view.frame.size.width - 20 * WIDTH, 40 * HEIGHT)];
        [viewOfBackForSectionThree addSubview:labelForSectionThree];
        [labelForSectionThree release];
        labelForSectionThree.text = @"      音乐演奏者";
        labelForSectionThree.font = [UIFont fontWithName:@"Arial" size:17.0];
        labelForSectionThree.dk_textColorPicker = DKColorWithColors([UIColor blackColor], [UIColor whiteColor]);
        return viewOfBackForSectionThree;
    }else if (section == 4){
        UIView *viewOfBackForSectionFour = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 40 * HEIGHT)];
        viewOfBackForSectionFour.dk_backgroundColorPicker = DKColorWithColors([UIColor colorWithRed:218 / 255.f green:219 / 255.f blue:216 / 255.f alpha:1], [UIColor colorWithRed:17 / 256.f green:27 / 256.f blue:47 / 256.f alpha:1]);
        UILabel *labelForSectionFour = [[UILabel alloc]initWithFrame:CGRectMake(10 * WIDTH, 5 * HEIGHT, self.view.frame.size.width - 20 * WIDTH, 40 * HEIGHT)];
        [viewOfBackForSectionFour addSubview:labelForSectionFour];
        [labelForSectionFour release];
        labelForSectionFour.text = @"      电台主播";
        labelForSectionFour.font = [UIFont fontWithName:@"Arial" size:17.0];
        labelForSectionFour.dk_textColorPicker = DKColorWithColors([UIColor blackColor], [UIColor whiteColor]);
        return viewOfBackForSectionFour;
    }else if (section == 5){
        UIView *viewOfBackForSectionFive = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 40 * HEIGHT)];
        viewOfBackForSectionFive.dk_backgroundColorPicker = DKColorWithColors([UIColor colorWithRed:218 / 255.f green:219 / 255.f blue:216 / 255.f alpha:1], [UIColor colorWithRed:17 / 256.f green:27 / 256.f blue:47 / 256.f alpha:1]);
        UILabel *labelForSectionFive = [[UILabel alloc]initWithFrame:CGRectMake(10 * WIDTH, 5 * HEIGHT, self.view.frame.size.width - 20 * WIDTH, 40 * HEIGHT)];
        [viewOfBackForSectionFive addSubview:labelForSectionFive];
        [labelForSectionFive release];
        labelForSectionFive.text = @"      演员";
        labelForSectionFive.font = [UIFont fontWithName:@"Arial" size:17.0];
        labelForSectionFive.dk_textColorPicker = DKColorWithColors([UIColor blackColor], [UIColor whiteColor]);
        return viewOfBackForSectionFive;
    }else if (section == 6){
        UIView *viewOfBackForSectionSix = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 40 * HEIGHT)];
        viewOfBackForSectionSix.dk_backgroundColorPicker = DKColorWithColors([UIColor colorWithRed:218 / 255.f green:219 / 255.f blue:216 / 255.f alpha:1], [UIColor colorWithRed:17 / 256.f green:27 / 256.f blue:47 / 256.f alpha:1]);
        UILabel *labelForSectionSix = [[UILabel alloc]initWithFrame:CGRectMake(10 * WIDTH, 5 * HEIGHT, self.view.frame.size.width - 20 * WIDTH, 40 * HEIGHT)];
        [viewOfBackForSectionSix addSubview:labelForSectionSix];
        [labelForSectionSix release];
        labelForSectionSix.text = @"      知名社会人士";
        labelForSectionSix.font = [UIFont fontWithName:@"Arial" size:17.0];
        labelForSectionSix.dk_textColorPicker = DKColorWithColors([UIColor blackColor], [UIColor whiteColor]);
        return viewOfBackForSectionSix;
    }else if (section == 7){
        UIView *viewOfBackForSectionSeven = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 40 * HEIGHT)];
        viewOfBackForSectionSeven.dk_backgroundColorPicker = DKColorWithColors([UIColor colorWithRed:218 / 255.f green:219 / 255.f blue:216 / 255.f alpha:1], [UIColor colorWithRed:17 / 256.f green:27 / 256.f blue:47 / 256.f alpha:1]);
        UILabel *labelForSectionSeven = [[UILabel alloc]initWithFrame:CGRectMake(10 * WIDTH, 5 * HEIGHT, self.view.frame.size.width - 20 * WIDTH, 40 * HEIGHT)];
        [viewOfBackForSectionSeven addSubview:labelForSectionSeven];
        [labelForSectionSeven release];
        labelForSectionSeven.text = @"      网络红人";
        labelForSectionSeven.font = [UIFont fontWithName:@"Arial" size:17.0];
        labelForSectionSeven.dk_textColorPicker = DKColorWithColors([UIColor blackColor], [UIColor whiteColor]);
        return viewOfBackForSectionSeven;
    }else if (section == 8){
        UIView *viewOfBackForSectionEight = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 40 * HEIGHT)];
        viewOfBackForSectionEight.dk_backgroundColorPicker = DKColorWithColors([UIColor colorWithRed:218 / 255.f green:219 / 255.f blue:216 / 255.f alpha:1], [UIColor colorWithRed:17 / 256.f green:27 / 256.f blue:47 / 256.f alpha:1]);
        UILabel *labelForSectionEight = [[UILabel alloc]initWithFrame:CGRectMake(10 * WIDTH, 5 * HEIGHT, self.view.frame.size.width - 20 * WIDTH, 40 * HEIGHT)];
        [viewOfBackForSectionEight addSubview:labelForSectionEight];
        [labelForSectionEight release];
        labelForSectionEight.text = @"      企业";
        labelForSectionEight.font = [UIFont fontWithName:@"Arial" size:17.0];
        labelForSectionEight.dk_textColorPicker = DKColorWithColors([UIColor blackColor], [UIColor whiteColor]);
        return viewOfBackForSectionEight;
    }else{
        UIView *viewOfBackForSectionNine = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 40 * HEIGHT)];
        viewOfBackForSectionNine.dk_backgroundColorPicker = DKColorWithColors([UIColor colorWithRed:218 / 255.f green:219 / 255.f blue:216 / 255.f alpha:1], [UIColor colorWithRed:17 / 256.f green:27 / 256.f blue:47 / 256.f alpha:1]);
        UILabel *labelForSectionNine = [[UILabel alloc]initWithFrame:CGRectMake(10 * WIDTH, 5 * HEIGHT, self.view.frame.size.width - 20 * WIDTH, 40 * HEIGHT)];
        [viewOfBackForSectionNine addSubview:labelForSectionNine];
        [labelForSectionNine release];
        labelForSectionNine.text = @"      社会团体";
        labelForSectionNine.font = [UIFont fontWithName:@"Arial" size:17.0];
        labelForSectionNine.dk_textColorPicker = DKColorWithColors([UIColor blackColor], [UIColor whiteColor]);
        return viewOfBackForSectionNine;
    }
    
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.section == 0) {

        return (self.view.frame.size.width - 10 * WIDTH - 15 * WIDTH * 5)/5 + 20 * HEIGHT + 20 * HEIGHT;
    }else{
        
        return 82.8 * HEIGHT;
    }
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 40 * HEIGHT;
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 0.01 * HEIGHT;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    ModelOfCellForClassifyVCSectionOneToNine *model = [self.arrForEverySection objectAtIndex:indexPath.section - 1];
    NSMutableArray *arr = model.users;
    NSMutableDictionary *dic = [arr objectAtIndex:indexPath.row];
    NSString *str = [dic objectForKey:@"id"];
    InformationVC *vc = [[InformationVC alloc]init];
    vc.id = str;
    [self.navigationController pushViewController:vc animated:YES];
}

- (void)handleCollectAlert{
    
    UIAlertController *alertForCollect = [UIAlertController alertControllerWithTitle:nil message:@"已收藏" preferredStyle:UIAlertControllerStyleAlert];
    
    UIAlertAction *sure = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        
    }];
    
    [alertForCollect addAction:sure];
    
    [self presentViewController:alertForCollect animated:YES completion:^{
    }];
    
}

- (void)handleDeleteAlert:(NSString *)str{
    UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"是否取消收藏" preferredStyle:UIAlertControllerStyleAlert];
    
    UIAlertAction *delete = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
    }];
    
    UIAlertAction *quxiao = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        
        
        [SQLHandler deleteDataForClassifyVC:str];
        
        [[NSNotificationCenter defaultCenter] postNotificationName:@"alreadyDelete" object:nil userInfo:nil];
    }];
    
    
    [alert addAction:quxiao];
    [alert addAction:delete];
    
    [self presentViewController:alert animated:YES completion:^{
        
    }];
}

- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController {
    if (tabBarController.selectedIndex == 3) {
        if(viewController == [tabBarController.viewControllers objectAtIndex:3])
        {
            [[NSNotificationCenter defaultCenter] postNotificationName:@"jumpForFourth" object:nil userInfo:nil];
            return YES;
        }
        
    }
    return YES;
}

- (void)viewWillAppear:(BOOL)animated{
    self.tabBarController.tabBar.hidden = NO;
    self.navigationController.navigationBarHidden = NO;
    if ([[NSUserDefaults standardUserDefaults] boolForKey:@"夜间模式"]) {
            
        [DKNightVersionManager nightFalling];
            
    } else {
        
        [DKNightVersionManager dawnComing];
    }
    self.tabBarController.tabBar.dk_barTintColorPicker = DKColorWithColors([UIColor whiteColor], [UIColor colorWithRed:18 / 256.f green:29 / 256.f blue:50 / 256.f alpha:1]);
    [self.tableView reloadData];
    

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
